$("#submission").click(function () {
    var customerName = $("#customerName").val();
    var customerAge = $("#customerAge").val();
    var customerSex = $("#customerSex").val();
    var customerPhone = $("#customerPhone").val();
    var phoneSharShip = $("#phoneSharShip").val();
    if (customerPhone == null || customerPhone == "") {
        alert("请输入手机号！");
        return
    }
    if (customerName == null || customerName == "") {
        alert("请输入姓名！");
        return
    }
    if (customerPhone.length > 0 && customerPhone.length < 7 || customerPhone.length > 8 && customerPhone.length < 11) {
        alert("当前输入号码格式不对，请重新输入！");
        return;
    }
    $.ajax({
        url: Feng.ctxPath + "/customer/temporaryCustomer",
        type: "post",
        data: {
            "customerName": customerName,
            "customerAge": customerAge,
            "customerPhone": customerPhone,
            "customerSex": customerSex,
            "phoneSharShip": phoneSharShip
        },
        success: function (data) {
            var a = data.split(",");
            if (a[0] == 0) {
                alert("手机号已存在,请输入新的手机号");
                parent.layer.close(parent.layer.getFrameIndex(window.name));
            } else {
                $("#customerName", parent.document).html(customerName);
                $("#customerAge", parent.document).html(customerAge);
                if (customerSex == '1') {
                    $("#customerSex", parent.document).html('男');
                } else if (customerSex == '2') {
                    $("#customerSex", parent.document).html('女');
                }
                $("#customerPhone", parent.document).html(customerPhone);
                $("#temporaryValue", parent.document).val('临时');
                $("#scordd", parent.document).val('dd');
                $("#customerId", parent.document).val(a[1]);
                parent.layer.close(parent.layer.getFrameIndex(window.name));
            }
        }
    });
});